from PyQt6.QtCore import Qt, QObject, pyqtSignal

class WindowStateManager(QObject):
    # 定义一个信号，当窗口状态改变时发出
    state_changed = pyqtSignal(Qt.WindowState)
    
    def __init__(self):
        super().__init__()
        # 将默认状态设置为最大化
        self._window_state = Qt.WindowState.WindowMaximized
    
    @property
    def state(self):
        return self._window_state
    
    @state.setter
    def state(self, new_state):
        if self._window_state != new_state:
            self._window_state = new_state
            # 发出信号通知所有窗口
            self.state_changed.emit(new_state)

# 创建全局状态管理器实例
manager = WindowStateManager() 